import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class DBDem01 {
   public static void main(String[] args) throws ClassNotFoundException, SQLException {
      Class.forName("com.mysql.jdbc.Driver");
      String url="jdbc:mysql://172.28.22.100:3306/2017jsj1";
      String username="2017jsj1";
      String password="123abc";
      Connection conn=(Connection) DriverManager.getConnection(url,username, password);
      Statement sta=conn.createStatement();
      //String sql="insert into user201705050140(name,pwd,type) values('ls','123',3)";
      //String sql="update userwts set pwd='123' where name='fff'";
      //String sql="delete from user201705050140";
      //int row=sta.executeUpdate(sql);
       //System.out.println(row);
       
        ResultSet rs=null;
        String sql="select * from user201705050140";
        rs=sta.executeQuery(sql);
        while (rs.next()) {
           for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
               System.out.println(rs.getObject(i+1)+"");
           }
            System.out.println();
           
      }
        if(rs!=null){
        rs.close();
        }
        
        if(sta!=null){
        sta.close();
        }
        
        if(conn!=null){
        conn.close();
        }
    }
}